<%@page import="entities.OwnerDomain"%>
<%@page import="entities.User"%>
<%@page import="helpers.DateHelper"%>
<%@page import="entities.CheckSpeed"%>
<%@page import="entities.InLink"%>
<%@page import="entities.IpAddress"%>
<%@page import="com.google.gson.Gson"%>
<%@page import="java.util.Map"%>
<%@page import="helpers.NumberHelper"%>
<%@page import="java.text.DecimalFormat"%>
<%@page import="entities.AnalyticDataSource"%>
<%@page import="java.util.List"%>
<%@page import="entities.DomainAnalytic"%>
<%@page import="entities.GoogleAnalytic"%>
<%@page import="entities.GoogleAdsense"%>
<%@page import="entities.Domain"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="entities.SiteConfig"%>
<%@page import="java.util.TreeMap"%>
<%
	request.setCharacterEncoding("UTF-8");
	TreeMap check = (TreeMap) request.getAttribute("check");
	User user = (User) request.getAttribute("user_logged_in");
	String success = (String) request.getAttribute("success");
	SiteConfig siteConfig = (SiteConfig) request.getAttribute("config");
	String image = UrlHelper.getServerUrl(request) + "/blobstore-serve?blob-key=" + siteConfig.getLogo();
	Domain domain = (Domain) request.getAttribute("domain");
	OwnerDomain ownerDomain = (OwnerDomain) request.getAttribute("ownerDomain");
	GoogleAdsense googleAdsense = (GoogleAdsense) request.getAttribute("googleAdsense");
	GoogleAnalytic googleAnalytic = (GoogleAnalytic) request.getAttribute("googleAnalytic");
	InLink inlink = (InLink) request.getAttribute("inlink");
	DomainAnalytic analytic = (DomainAnalytic) request.getAttribute("domainAnalytic");
	IpAddress ipAddress = (IpAddress) request.getAttribute("ipAddress");
	CheckSpeed checkSpeed = (CheckSpeed) request.getAttribute("checkSpeed");
	
	//Set content for seo
	String title = domain.getDomain() + " Website - " + domain.getTitle();
	String description = domain.getDomain() + " information: " + domain.getDescription();
	String keywords = domain.getDomain() + ", www." + domain.getDomain() + ", web site analysis, website traffic details, server information, website ranking info, check information my domain" ;
	String url = UrlHelper.getServerUrl(request) + "/info/" + domain.getDomain();
	String ogimage = "http://immediatenet.com/t/t_a?Size=1024x768&URL=" + domain.getDomain();
%>

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogimage" value="<%=ogimage %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

				<script type="text/javascript" src="/js/info.js"></script>
				<script type='text/javascript' src='https://www.google.com/jsapi'></script>
				<script type="text/javascript">
				var url = "<%=UrlHelper.getServerUrl(request) %>/ajax/update-domain/<%=domain.getDomain() %>";
				</script>
				
				<div id="leftSideContent">
                	
                	<!-- Site Info -->
                	<section class="block siteChecked">
                    	<div class="blockContent clearafter">
                    		<div class="top clearafter">
                    			<div class="left">
	                    			<img src="http://chart.apis.google.com/chart?chs=80x80&cht=qr&chld=|0&chl=http://<%=domain.getDomain() %>" />
	                    		</div>
	                    		<div class="right">
	                    			<h1><a href="/out/<%=domain.getDomain() %>"><%=domain.getDomain() %></a></h1>
	                    			<p>
	                    			<% if (domain.getDescription().isEmpty()) { %>
	                    				<%=domain.getDomain() %> has Alexa Rank <%=NumberHelper.numberFormat(domain.getAlexaRank()) %> and Google Page Rank is <%=domain.getGooglePageRank() %>
	                    			<% } else { %>
	                    				<% if (ownerDomain != null && ownerDomain.getIsUpdated() == 0 && !ownerDomain.getDescription().isEmpty()) { %>
											<span style="color: red"><%=ownerDomain.getDescription() %></span>
										<% } else { %>
											<%=domain.getDescription() %>
										<% } %>
	                    			<% } %>
	                    			</p>
	                    			<div class="adv">
	                    				<script type="text/javascript"><!--
										google_ad_client = "ca-pub-2883566427648799";
										/* epufloor_468x60 */
										google_ad_slot = "4163244680";
										google_ad_width = 468;
										google_ad_height = 60;
										//-->
										</script>
										<script type="text/javascript"
										src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
										</script>
	                    			</div>
	                    			<%
	                    			int rating = 3;
	                    			if (domain.getGooglePageRank() > 6) { 
	                    				rating = 5;
	                    			} else if (domain.getGooglePageRank() > 2) {
	                    				rating = 4;
	                    			};
	                    			%>
	                    			​<div class="hreview hidden">
	                    				Rating: <span class="rating"><%=rating %></span>
	                    			</div>
	                    		</div>
                    		</div>
                    		<p class="websiteOwner">
                    			<% if (user == null) { %>
                    			If you are the owner of this website, please <a href="/login">login</a> to edit the contents.
                    			<% } %>
                    		</p>
                    		
                    	</div>
                    	<div class="blockShadow"></div>
                    </section>
                	<!-- End Site Info -->
                	
                	<!-- Content Analytic -->
                    <section class="block" id="content-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Content Analysis</span></h3>
                            <div class="contentAnalysis">
                            	<div class="adv top">
                            		<script type="text/javascript"><!--
										google_ad_client = "ca-pub-2883566427648799";
										/* epufloor_468x60 */
										google_ad_slot = "4163244680";
										google_ad_width = 468;
										google_ad_height = 60;
										//-->
										</script>
										<script type="text/javascript"
										src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
										</script>
                            	</div>
                            	
                            	<p class="topIntro">
                                	<%=domain.getDomain() %> has Alexa Rank <%=NumberHelper.numberFormat(domain.getAlexaRank()) %> and Google Page Rank is <%=domain.getGooglePageRank() %>
                                	
                                	<br /><br />
                                	<script type="text/javascript"><!--
									google_ad_client = "ca-pub-2883566427648799";
									/* link_menu 468x15 */
									google_ad_slot = "8735411486";
									google_ad_width = 468;
									google_ad_height = 15;
									//-->
									</script>
									<script type="text/javascript"
									src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
									</script>
                                </p>
                                
                                <div class="gridLayout gridLayout2 clearafter">
                                	<div class="gridCol">
                                    	<div class="gridCol_inner">
                                        	<h3 class="title">Title</h3>
                                            <p>
                                            	<% if (ownerDomain != null && ownerDomain.getIsUpdated() == 0 && !ownerDomain.getTitle().isEmpty()) { %>
													<span style="color: red"><%=ownerDomain.getTitle() %></span>
												<% } else { %>
													<%=domain.getTitle() %>
												<% } %>
                                            </p>
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                    	<div class="gridCol_inner">
                                        	<h3 class="title">Page Size</h3>
                                            <p><%=domain.getPageSize() %></p>
                                        </div>
                                    </div>
                                </div>
                                <div class="gridLayout gridLayout2 clearafter">
                                	<div class="gridCol">
                                    	<div class="gridCol_inner">
                                        	<h3 class="title">Meta Keywords</h3>
                                            <p>
                                            	<%=domain.getKeywords() %>
                                            </p>
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                    	<div class="gridCol_inner">
                                        	<h3 class="title">Images</h3>
                                        	<%
                                        	Map<String, String> images = new Gson().fromJson(domain.getImages(), Map.class);
                                        	if (images.size() > 0) {
                                        	%>
                                            <ul>
                                            	<li>
                                            		<%
                                            			int count = 0;
                                            			for (Map.Entry<String, String> entry : images.entrySet()) { 
                                            		%>
                                            		    <%=count > 0? ", ": "" %><%=entry.getValue() %>&nbsp;<%=entry.getKey() %>
                                            		<% 
                                            				count ++;
                                            			} 
                                            		%>
                                            	</li>
                                            </ul>
                                            <% } %>
                                        </div>
                                        <br />
                                        <div class="gridCol_inner">
                                        	<h3 class="title">Heading</h3>
                                        	<%
                                        	Map<String, String> heading = new Gson().fromJson(domain.getHeading(), Map.class);
                                        	if (images.size() > 0) {
                                        	%>
                                            <ul>
                                            	<li>
                                            		<%
                                            			int count = 0;
                                            			for (Map.Entry<String, String> entry : heading.entrySet()) { 
                                            		%>
                                            		    <%=count > 0 ? ", ": "" %><%=entry.getKey() %>:&nbsp;<%=entry.getValue() %>
                                            		<% 
                                            				count ++;
                                            			} 
                                            		%>
                                            	</li>
                                            </ul>
                                            <% } %>
                                        </div>
                                    </div>
                                </div>
                                <div class="gridLayout clearafter">
                                    <div class="gridCol lastCol">
                                    	<div class="gridCol_inner">
                                        	<h3 class="title">Meta Description</h3>
                                            <% if (ownerDomain != null && ownerDomain.getIsUpdated() == 0 && !ownerDomain.getDescription().isEmpty()) { %>
												<span style="color: red"><%=ownerDomain.getDescription() %></span>
											<% } else { %>
												<%=domain.getDescription() %>
											<% } %>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                    <!-- End Content Analytic -->
                	
                	
                	<!-- Visitor Analytic --> 
                	<% if (!domain.getCountryVisitor().isEmpty()) { %>
                    <section class="block"  id="visitor-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Visitor Analysis</span></h3>
                            <div class="visitorAnalysis">
                                <div class="gridLayout gridLayout3 clearafter">
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                        	<p class="topIntro">
			                    				<script type="text/javascript"><!--
												google_ad_client = "ca-pub-2883566427648799";
												/* link_menu 468x15 */
												google_ad_slot = "8735411486";
												google_ad_width = 468;
												google_ad_height = 15;
												//-->
												</script>
												<script type="text/javascript"
												src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
												</script>
				                    		</p>
                                            <h3 class="title">Daily Visitor</h3>
                                            <ul>
                                                <li><%=NumberHelper.numberFormat(domain.getDailyVisitor()) %> visits</li>                                                
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                                <%
                            	Map<String, String> visitors = new Gson().fromJson(domain.getCountryVisitor(), Map.class);
                                if (visitors.size() > 0) {
								%>
                            	<div class="gridLayout gridLayout3 clearafter">
                            		<h3 class="title">Visitor Contry Map</h3>
									    <script type='text/javascript'>
									     google.load('visualization', '1', {'packages': ['geochart']});
									     google.setOnLoadCallback(drawRegionsMap);
									
									      function drawRegionsMap() {
									        var data = google.visualization.arrayToDataTable([
									          ['Country', 'Percent (%)'],
									          <%
									          for (Map.Entry<String, String> entry : visitors.entrySet()) { 
										      %>
										      ['<%=entry.getKey() %>', <%=entry.getValue() %>],
										      <%	}
											    %>
									        ]);
									
									        var options = {numberFormat:'.#'};
									
									        var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
									        chart.draw(data, options);
									    };
									    </script>
									    <div id="chart_div" style="height: 500px;"></div>
									    
                            		<!-- end visitor -->
                            	</div>
                            	<% } %>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                    <% } %>
                    <!-- End Visitor Analytic -->
                	
                	
                	<!-- DNS Analytic -->
                	<% if (!domain.getSoaRecord().isEmpty() || !domain.getDnsRecords().isEmpty()) { %>
                	<section class="block"  id="dns-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>DNS Record Analysis</span></h3>
                            <div class="dnsRecordAnalysis">
                            	<p class="topIntro">
                                	The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities. A Domain Name Service resolves queries for these names into IP addresses for the purpose of locating computer services and devices worldwide. By providing a worldwide, distributed keyword-based redirection service, the Domain Name System is an essential component of the functionality of the Internet. 
                                </p>
                                <br />
                                <div class="soa-record">
                                	<%=domain.getSoaRecord() %>
                                </div>
                                
                                <div class="dns-record">
                                	<%=domain.getDnsRecords() %>
                                </div>
                                
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                    <% } %>
                	<!-- End DNS Analytic -->
                	
                	
                	<!-- Traffic Analytic -->
                	<section class="block" id="traffic-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Traffic Analysis</span></h3>
                            <div class="trafficAnalysis">
                                <div class="gridLayout gridLayout2 clearafter">
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Daily Ranks</h3>
                                            <img src="http://traffic.alexa.com/graph?c=1&u=<%=domain.getDomain() %>&r=6m&y=t&z=3&h=200&w=280&b=FFFFFF">
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Rank Trend</h3>
                                            <img src="http://traffic.alexa.com/graph?&w=295&h=200&o=f&c=1&y=t&b=ffffff&r=4y&u=<%=domain.getDomain() %>" />
                                        </div>
                                    </div>
                                </div>
                                <div class="gridLayout gridLayout2 clearafter">
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Visitor Trend</h3>
                                            <img src="http://grapher.compete.com/<%=domain.getDomain() %>_uv_310.png" />
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Bounce Trend</h3>
                                            <img src="http://traffic.alexa.com/graph?&w=295&h=200&o=f&c=1&y=b&b=ffffff&r=4y&u=<%=domain.getDomain() %>" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                	<!-- End Traffic Analytic -->
                	
                	
                	<!-- Header Analytic -->
                	<section class="block"  id="http-header-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Http Header Analysis</span></h3>
                            <div class="httpAnalysis">
                            	<p class="topIntro"> Hyper Text Transfer Protocol (HTTP) header show data header response from <%=domain.getDomain() %> . </p>
                            	<h3 class="title"><span>HTML Analysis</span></h3>
                            	<%
                               	Map<String, String> headers = new Gson().fromJson(domain.getHeaders(), Map.class);
                               	if (headers.size() > 0) {
                               	%>
                                   <ul>
                                   		<%
                                   			int count = 0;
                                   			for (Map.Entry<String, String> entry : headers.entrySet()) { 
                                   		%>
                                   		<li>
                                   			<span><%=entry.getKey() %>:</span>
                                   		   	<%=entry.getValue() %>
                                   		</li>
                                   		<% 
                                   				count ++;
                                   			} 
                                   		%>
                                   </ul>
                                <% } %>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                	<!-- End Header Analytic -->
                	
                	<!-- Technical Analytic -->
                	<section class="block" id="technical-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Site Technical Analysis</span></h3>
                            <div class="httpAnalysis">
                            	<div class="gridLayout gridLayout3 clearafter">
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Web server</h3>
                                            <ul>
                                                <li><%=domain.getWebServer() %></li>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Javascript Library</h3>
                                            <%
			                               	List<String> libJs = new Gson().fromJson(domain.getJavascriptLibrary(), List.class);
			                               	%>
                                            <ul>
                                            	<% for (int i = 0; i < libJs.size(); i++) { %>
                                                <li><%=libJs.get(i) %></li>
                                                <% } %>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Ip Address</h3>
                                            <ul>
                                                <li><a href="/ip/<%=domain.getIpAddress() %>"><%=domain.getIpAddress() %></a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="gridLayout gridLayout3 clearafter">
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Language used</h3>
                                            <ul>
                                                <li>HTML</li>
                                                <li>CSS</li>
                                                <li>JAVASCRIPT</li>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Domain Age</h3>
                                            <ul>
                                                <li><%=domain.getAge() %></li>
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">Check speed</h3>
                                            <ul>
                                                <li><a rel="nofollow" href="/check-speed?domain=<%=domain.getDomain()%>">Check Speed</a></li>
                                            </ul>
                                        </div>
                                    </div>
                               </div>
                               
                               <% if (ipAddress != null) { %>
                               <div class="gridLayout clearafter">
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                        	<h3 class="title">
                                        		Site same Ip <%=domain.getIpAddress() %>
                                        		<a class="view-more right" href="/ip/<%=domain.getIpAddress() %>">(View more...)</a>
                                        	</h3>
                                        	<ul>
                                        		<li>
                                        			<%
                                        			List<String> ipAddressDomains = ipAddress.getDomains();
                                        			for (int i = 0; i < ipAddressDomains.size(); i++) { 
                                        				if (i >= 20) break;
                                        			%>
                                        			<%=i > 0 ? ", " : "" %><a href="/info/<%=ipAddressDomains.get(i) %>"><%=ipAddressDomains.get(i) %></a>
                                        			<% } %>
                                        		</li>
                                        	</ul>
                                        </div>
                                    </div>
                               </div>
                               <% } %>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                	<!-- End Header Analytic -->
                	
                	<!-- Hosting analytics -->
                	<% if (!domain.getIpAddress().isEmpty() && ipAddress != null && !ipAddress.getDecimal().isEmpty()) { %>
                	<section class="block" id="hosting-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Hosting Analysis</span></h3>
                            <div class="hostingAnalysis">
                                <div class="clearafter">
                                	<div class="left">
                                    	<ul>
                                        	<li>
                                            	<h3 class="title">IP Address</h3>
                                                <p><%=ipAddress.getIp() %></p>
                                            </li>
                                            <li>
                                            	<h3 class="title">IP Decimal (Long)</h3>
                                                <p><%=ipAddress.getDecimal() %></p>
                                            </li>
                                            <li>
                                            	<h3 class="title">Reverse IP</h3>
                                                <p><%=ipAddress.getHostname() %></p>
                                            </li>
                                            <li>
                                            	<h3 class="title">ISP</h3>
                                                <p><%=ipAddress.getIsp() %></p>
                                            </li>
                                            <li>
                                            	<h3 class="title">Organization</h3>
                                                <p><%=ipAddress.getOrganization() %></p>
                                            </li>
                                            <li>
                                            	<h3 class="title">Services</h3>
                                                <p><%=ipAddress.getServices() %></p>
                                            </li>
                                            <li>
                                            	<h3 class="title">Type</h3>
                                                <p><%=ipAddress.getType() %></p>
                                            </li>
                                        </ul>
                                    </div>
                                    <div class="right">
                                    	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
										<script type="text/javascript">
										  function initialize() {
										    var myLatlng = new google.maps.LatLng(<%=ipAddress.getLatitude()%>,<%=ipAddress.getLongitude()%>);
										    var myOptions = {
										      zoom: 5,
										      center: myLatlng,
										      navigationControl: true,
										      scaleControl: false,
										      mapTypeControl: false,
										      mapTypeId: google.maps.MapTypeId.ROADMAP
										    }
										    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
										    var image = 'http://cdn.whatismyipaddress.com/images/marker_sq.png';
										    var beachMarker = new google.maps.Marker({
										        position: myLatlng,
										        map: map,
										        icon: image
										    });
										    
										    var populationOptions = {
												strokeColor: "#990000",
												strokeOpacity: 0.5,
												strokeWeight: 1,
												fillColor: "#FF0000",
										    	fillOpacity: 0.15,
										    	map: map,
										    	center: myLatlng,
										    	radius: 25000
											};
											cityCircle = new google.maps.Circle(populationOptions);
										    
										}
										</script>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                	<% } %>
                	<!-- Hosting analytics -->
                	
                	
                	<!-- Link Analytics -->
                	<section class="block" id="links-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Links Analysis</span></h3>
                            <div class="httpAnalysis">
                            	<p class="topIntro"> 
									<%=domain.getDomain() %> has <%=domain.getOutlink().size() %> outlinks and <%=inlink != null ? inlink.getDomains().size() : "0" %> inlinks. The relation of external links to inner links influences the distribution of the site's weight in general. To grow the amount of indexed pages, there should be more inner links than external links.
                            	</p>
                            	
                            	<div class="gridLayout clearafter">
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                        	<h3 class="title">
                                        		Outbound Links
                                        		<a class="view-more right" href="/outlink/<%=domain.getDomain()%>">(View more...)</a>
                                        	</h3>
                                        	
                                        	<ul>
                                        		<li>
                                        			<%
                                        			String o = "";
                                        			List<String> outlinks = domain.getOutlink();
                                        			for (int i = 0; i < outlinks.size(); i++) { 
                                        				if (i >= 20) break;
                                        				o = UrlHelper.fomatDomains(outlinks.get(i));
                                        			%>
                                        			<%=i > 0 ? ", " : "" %><a href="/info/<%=o %>"><%=o %></a>
                                        			<% } %>
                                        		</li>
                                        	</ul>
                                        </div>
                                    </div>
                               </div>
                               
                               <% if (inlink != null && inlink.getDomains().size() > 0) { %>
                               <div class="gridLayout clearafter">
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                        	<h3 class="title">
                                        		Inbound Links
                                        		<a class="view-more right" href="/inlink/<%=domain.getDomain()%>">(View more...)</a>
                                        	</h3>
                                        	<ul>
                                        		<li>
                                        			<%
                                        			List<String> inlinks = inlink.getDomains();
                                        			for (int i = 0; i < inlinks.size(); i++) { 
                                        				if (i >= 20) break;
                                        			%>
                                        			<%=i > 0 ? ", " : "" %><a href="/info/<%=inlinks.get(i) %>"><%=inlinks.get(i) %></a>
                                        			<% } %>
                                        		</li>
                                        	</ul>
                                        </div>
                                    </div>
                               </div>
                               <% } %>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                	<!-- End Link Analytics -->
                	
                	
                	<!-- Google Service -->
                	<% if (googleAnalytic != null || googleAdsense != null) { %>
                	<section class="block"  id="google-service-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Google Services</span></h3>
                            <div class="googleService">
                            	<% if (googleAnalytic != null) { %>
                            	<div class="gridLayout gridLayout2 clearafter">
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                        	<h3 class="title">Google Analytic Id</h3>
                                        	<ul>
                                        		<li><%=domain.getGoogleAnalyticId() %></li>
                                        	</ul>
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                        	<h3 class="title">
                                        		Site Same Analytic
                                        		<a class="view-more right" href="/an/<%=domain.getGoogleAnalyticId()%>">(View more...)</a>
                                        	</h3>
                                        	<ul>
                                        		<li>
                                        			<%
                                        			List<String> analyticDomains = googleAnalytic.getDomains();
                                        			for (int i = 0; i < analyticDomains.size(); i++) {
                                        				if (i >= 20) break;
                                        			%>
                                        			<%=i > 0 ? ", " : "" %><a href="/info/<%=analyticDomains.get(i) %>"><%=analyticDomains.get(i) %></a>
                                        			<% } %>
                                        		</li>
                                        	</ul>
                                        </div>
                                    </div>
                                </div>
                                <% } %>
                                <% if (googleAdsense != null) { %>
                                <div class="gridLayout gridLayout2 clearafter">
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                        	<h3 class="title">
                                        		Google Adsense Id
                                        	</h3>
                                        	<ul>
                                        		<li><%=domain.getGoogleAdsenseId() %></li>
                                        	</ul>
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                        	<h3 class="title">
                                        		Site Same Adsense
                                        		<a class="view-more right" href="/ad/<%=domain.getGoogleAdsenseId()%>">(View more...)</a>
                                        	</h3>
                                        	<ul>
                                        		<li>
                                        			<%
                                        			List<String> adsenseDomains = googleAdsense.getDomains();
                                        			for (int i = 0; i < adsenseDomains.size(); i++) { 
                                        				if (i >= 20) break;
                                        			%>
                                        			<%=i > 0 ? ", " : "" %><a href="/info/<%=adsenseDomains.get(i) %>"><%=adsenseDomains.get(i) %></a>
                                        			<% } %>
                                        		</li>
                                        	</ul>
                                        </div>
                                    </div>
                                </div>
                                <% } %>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                    <% } %>
                	<!-- End Header Analytic -->
                	
                	<!-- Whois Analytic -->
                	<% if (!domain.getWhois().isEmpty() || !domain.getWhoisIp().isEmpty()) { %>
                	<section class="block" id="whois-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>Whois Analysis</span></h3>
                            <div class="whoisAnalysis">
                            	<% if (!domain.getWhois().isEmpty()) { %>
                            	<div class="whois-data">
                            		<h3 class="title">Whois Data</h3>
                            		<span class="view-more">(View more...)</span>
                            		<%=domain.getWhois() %>
                            	</div>
                                <br /><br />
                                <% } %>
                                <% if (!domain.getWhoisIp().isEmpty()) { %>
                                <div class="whois-ip">
                                	<h3 class="title">Whois Ip</h3>
                                	<span class="view-more">(View more...)</span>
                                	<%=domain.getWhoisIp().replaceAll("\n", "<br />") %>
                                </div>
                                <% } %>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                    <% } %>
                	<!-- End Whois Analytic -->
                	
                	
                	<!-- Check Speed Analytic -->
                	<% if (checkSpeed != null && !checkSpeed.getId().isEmpty() && !checkSpeed.isProcessing()) { %>
                	<section class="block" id="checkspeed-analysis">
                    	<div class="blockContent" id="checkspeed">
                        	<h3 class="blockHeading"><span>Check Speed Analysis</span></h3>
                            <div class="checkSpeedAnalysis">
                            	 <div class="gridLayout summary-result clearafter">
                                	<div class="gridCol lastCol">
                                		<div class="gridCol_inner">
                                			<h3 class="title">Summary</h3>
                                			
		                                	<%=checkSpeed.getTableResult() %>
			    	
									    	<table cellspacing="0" cellpadding="20" border="1" align="center" class="pretty result" id="table1">
								                <tbody>
								                <tr>
								                    <th valign="middle" align="center" class="empty"></th>
								                    <th valign="middle" align="center">First View</th>
								                    <th valign="middle" align="center">Repeat View</th>                </tr>
								                <tr>
								                    <td valign="middle" align="left">Waterfall</td>
								                    <td valign="middle" align="center"><img width="250" src="<%=checkSpeed.getWaterfallThumb()%>" class="progress"></td>
								                    <td valign="middle" align="center"><img width="250" src="<%=checkSpeed.getWaterfallCachedThumb() %>" class="progress"></td>
								                </tr>
									    		</tbody>
									    	</table>
									    </div>
									</div>
                                </div>
                            	
                            	<div class="gridLayout content-breakdown clearafter">
                                	<div class="gridCol lastCol">
                                		<div class="gridCol_inner">
                                			<h3 class="title">Content Breakdown</h3>
                                			
                                			<!--Load the AJAX API-->
										    <script type="text/javascript">
											<%=checkSpeed.getContentBreakdown() %>
											</script>
											
											<table align="center">
										        <tr>
										            <th colspan="2">
										            <h2>Content breakdown by MIME type (First  View)</h2>
										            </th>
										        </tr>
										        <tr>
										            <td>
										                <div id="pieRequestsFv_div" style="width:300px; height:300px;"></div>
										            </td>
										            <td>
										                <div id="pieBytesFv_div" style="width:300px; height:300px;"></div>
										            </td>
										        </tr>
										        <tr>
										            <td>
										                <div id="tableRequestsFv_div" style="width: 100%;"></div>
										            </td>
										            <td>
										                <div id="tableBytesFv_div" style="width: 100%;"></div>
										            </td>
										        </tr>
										    </table>
										    
										    <hr />
										    <h2>Connection View</h2>
										    <img src="<%=checkSpeed.getConnectionView() %>">
										    <br />
										    
										    <hr />
										    <table align="center">
										        <tr>
										            <th colspan="2">
										            <h2>Content breakdown by MIME type (Repeat  View)</h2>
										            </th>
										        </tr>
										        <tr>
										            <td>
										                <div id="pieRequestsRv_div" style="width:300px; height:300px;"></div>
										            </td>
										            <td>
										                <div id="pieBytesRv_div" style="width:300px; height:300px;"></div>
										            </td>
										        </tr>
										        <tr>
										            <td>
										                <div id="tableRequestsRv_div" style="width: 100%;"></div>
										            </td>
										            <td>
										                <div id="tableBytesRv_div" style="width: 100%;"></div>
										            </td>
										        </tr>
										    </table>
											
											<hr />
											
											<h2>Connection View (Repeat View)</h2>
										    <img src="<%=checkSpeed.getConnectionViewRp()%>">
										    <br /> 
                                			
                                		</div>
                                	</div>
                                </div>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                    <% } %>
                	<!-- End Check Speed Analytic -->
                	
                	
                	<!-- HTML Analytic -->
                	<section class="block" id="html-analysis">
                    	<div class="blockContent">
                        	<h3 class="blockHeading"><span>HTML Analysis</span></h3>
                            <div class="htmlAnalytics">
                            	<div class="gridLayout gridLayout2 clearafter">
                                    <div class="gridCol">
                                        <div class="gridCol_inner">
                                            <h3 class="title">HTML validation</h3>
                                            <ul>
                                                <li><%=domain.getValidError() %> Errors</li>
                                                <li><%=domain.getValidWarnings() %> Warnings</li>
                                            </ul>
                                            <br />
                                            <h3 class="title">Ratio Text/Html</h3>
                                            <ul>
                                                <li><%=domain.getRatioTextHtml() %></li>                                                
                                            </ul>
                                        </div>
                                    </div>
                                    <div class="gridCol lastCol">
                                        <div class="gridCol_inner">
                                            <script type="text/javascript">
										      google.load("visualization", "1", {packages:["corechart"]});
										      google.setOnLoadCallback(drawChart);
										      function drawChart() {
										        var data = google.visualization.arrayToDataTable([
										          ['', 'Warning', 'Error'],
										          ['',  <%=domain.getValidWarnings() %>,      <%=domain.getValidError()%>],
										        ]);
										
										        var options = {
										          title: 'HTML Validate',
										          hAxis: {title: '', titleTextStyle: {color: 'red'}}
										        };
										
										        var chart = new google.visualization.ColumnChart(document.getElementById('chart_valid_div'));
										        chart.draw(data, options);
										      }
										    </script>
										    <div id="chart_valid_div" style="width: 310px; height: 200px;"></div>
                                        </div>
                                    </div>
                                </div>
                                
                                <% if (!domain.getStrValidError().isEmpty()) { %>
                                <div class="gridLayout msgError clearafter">
                                    <div class="gridCol lastCol">
                                    	<div class="gridCol_inner">
                                    		<div class="message-error-html">
	                                        	<h3 class="title">Message Error</h3>
	                                        	<span class="view-more">(View more...)</span>
	                                        	<ol>
	                                            <%=domain.getStrValidError().replace("src=\"images", "src=\"/images") %>
	                                            </ol>
	                                            <div class="clearafter"></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <% } %>
                            </div>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                	<!-- End HTML Analytic -->
                	
                    <section class="block">
                    	<div class="blockContent lastUpdated">
                    		<% if (!domain.isProcessing()) { %>
                        	This data was last updated from <%=DateHelper.getStringFromDate(domain.getUpdated(), "dd-MM-yyyy") %>&nbsp;
                        		<% if (!DateHelper.checkGreaterNow(domain.getUpdated(), 1440)) { %> 
	                        	<a href="#" class="update-data">(update data)</a>.
	                        	<% } %>
                        	<% } else { %>
                        	Processing update domain...
                        	<% } %>
                        </div>
                        <div class="blockShadow"></div>
                    </section>
                </div>
                
                <!-- right content -->
				<jsp:include page="/elements/right.jsp">
					<jsp:param name="name" value="<%=domain.getDomain()%>" />
				</jsp:include>
                <!-- end right content -->

<jsp:include page="/layouts/footer.jsp" />